package com.freesome.flii.events
{
	import flash.events.Event;
	import flash.utils.*;
	import com.freesome.flii.Flii;

	public class FliiEvent extends Event
	{
		public var data:Object;
		
		//Event types.
		
		/**
		 * Event dispatches acceleration data
		 * data packet contains:
		 * x,y,z = acceleration in x,y,z directions
		 * type = 0 = wiimote, 1= nunchuck
		 * 
		 **/		 
		public static var onAC:String = "onAC";
		/**
		 * Event dispatches joystick position data
		 * data packet contains
		 * x,y = position of joystick
		 * type 0 = nunchuck, 1 = classic controller (not yet supported)
		 **/
		 public static var onJOY:String = "onAC";
		 /**
		 * Event Dispatches general wiimote messages
		 * data packet contains:
		 * msg - string containing the message
		 **/
		 public static var onDATA:String = "onDATA";
		 /**
		 * Event dispatches button data
		 * data packet contains:
		 * type: which button - see the flii class for button constants
		 * pressed:boolean - true = pressed, false - released
		 * 
		 **/
		 public static var onBUT:String = "onBUT";
		 /**
		 * Event dispatches IR data, you must have a sensor bar
		 * to use this.  If you have a wii, you must turn the wii
		 * on after yu sync the wiimote with flii
		 * data packet contains:
		 * x,y
		 * 
		 * 
		 **/
		 public static var onIR:String = "onIR";
		 /**
		 * Event notifies that calibration data from the wiimote has been received.
		 * Calibratin data is contained in the 
		 * Flii.WiiRemotexxxx variables
		 * Please see http://www.wiili.org/index.php/Motion_analysis for details on how to 
		 * convert this info into pitch, yaw data
		 **/
		 public static var onWiiCalibrate:String ="onWiiCalibrate";
		 /**
		 * Event notifies that calibration data from the nunchuck has been received.
		 * Calibratin data is contained in the 
		 * Flii.WiiNunchukxxxx variables
		 * Please see http://www.wiili.org/index.php/Motion_analysis for details on how to 
		 * convert this info into pitch, yaw data
		 **/
		 public static var onNunchuckCalibrate:String ="onNunchuckCalibrate";	
	
		
		public function FliiEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, data:Object=null)
		{
			super(type, bubbles, cancelable);
			this.data = data;
			
			//log the size of this message
			for (var a in data) {
				Flii.currData+=4;
				//var o:Object = data[a];
				//getQualifiedClassName(o);
				
			}
			
		}
		
	}
}